Repository navigation
Conversation
…me safety Fixes: mutex acquisition from the pthread TLS destructor (retireThreadByTid lock-free path), TidIndex use-after-free for in-flight lock-free readers in ~ThreadFilter, capacityExhausted() hint/gate contract, and context-window state update races.
…cker state fixes Timer loops re-read recordingEpoch() each tick instead of caching it; stop() keeps the pthread_t when pthread_join fails; flushUnownedBlockedTail resets only on valid payloads; owned-run admission preserves unflushed unowned-blocked weight; test-only exitBlockedRun overload gated behind UNIT_TEST; epoch publish ordering tightened. Adds lazyBackfill timer-path coverage and positive-path fuzz assertions for owned-block suppression.
…k engine teardown
…aProfilerTestSupport to test sources The registry-activity accessor now returns false in release builds; the hooks live on JavaProfiler (DEBUG-gated natives) instead of a public support class shipped in the main jar.
…haos threads stopProfiler() no longer wipes trace context unconditionally; the force-wall-start-failure toggle is disarmed in @AfterEach; wall-precheck counter reads use getOrDefault to avoid NPEs; the parked-worker spin loop yields; the churn antagonist checks join results and reuses one interruptor thread.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f77b7836b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
More details
The completed static review identified no reportable defects in deferred thread retirement, wall-clock restart handling, or blocked-time accounting. Runtime behavior was not tested.
🤖 Bits Code Review · Commit 3f77b78
CI Test ResultsRun: #44814879809 | Commit:
No CI outcome reports were found for this run. Updated: 2026-11-20 20:52:51 UTC |
Preserve reusable exact-ID roots and retained context across rotations and recording/context restarts. Keep ordinary sample weight one while accounting for timer work and wake lateness with monotonic deadlines. Add fixed-size phase diagnostics and bounded shutdown/drain regressions without weakening the one-second collapsing oracle.
Scan-Build Report
Bug Summary
Filter Results by FileReports
|
|||||||||||||||||||||||||||||||||||||||||||||||||
This comment has been minimized.
This comment has been minimized.
Reliability & Chaos Results❌ 24 failure(s) detected Pipeline: https://gitlab.ddbuild.io/DataDog/java-profiler/-/pipelines/152683221 ❌ chaos: profiler gmalloc aarch64 21 0 3 temXchaos❌ chaos: profiler gmalloc aarch64 25 0 3 temXchaos❌ chaos: profiler gmalloc amd64 21 0 3 temXchaos❌ chaos: profiler gmalloc amd64 25 0 3 temXchaos❌ chaos: profiler jemalloc aarch64 21 0 3 temXchaos❌ chaos: profiler jemalloc aarch64 25 0 3 temXchaos❌ chaos: profiler jemalloc amd64 21 0 3 temXchaos❌ chaos: profiler jemalloc amd64 25 0 3 temXchaos❌ chaos: profiler tcmalloc aarch64 21 0 3 temXchaos❌ chaos: profiler tcmalloc aarch64 25 0 3 temXchaos❌ chaos: profiler tcmalloc amd64 21 0 3 temXchaos❌ chaos: profiler tcmalloc amd64 25 0 3 temXchaos❌ chaos: profiler tracer gmalloc aarch64 21 0 3 temXchaos❌ chaos: profiler tracer gmalloc aarch64 25 0 3 temXchaos❌ chaos: profiler tracer gmalloc amd64 21 0 3 temXchaos❌ chaos: profiler tracer gmalloc amd64 25 0 3 temXchaos❌ chaos: profiler tracer jemalloc aarch64 21 0 3 temXchaos❌ chaos: profiler tracer jemalloc aarch64 25 0 3 temXchaos❌ chaos: profiler tracer jemalloc amd64 21 0 3 temXchaos❌ chaos: profiler tracer jemalloc amd64 25 0 3 temXchaos❌ chaos: profiler tracer tcmalloc aarch64 21 0 3 temXchaos❌ chaos: profiler tracer tcmalloc aarch64 25 0 3 temXchaos❌ chaos: profiler tracer tcmalloc amd64 21 0 3 temXchaos❌ chaos: profiler tracer tcmalloc amd64 25 0 3 temXchaos |
Keep unified reservoir accounting and original-context tails. Retain up to four original-window weight segments and serialize deferred observations at their original epoch timestamps, committing successful writes separately. Settle prior sampling statistics before changing pass counts and publish population boundaries before dispatch. Consumers must scale by the sample timestamp epoch. Unchanged-pool mid-pass send failures can still leave coalesced straddling units at the prior success ratio; that disclosed limitation needs a dedicated follow-up. Lazy sidecar backing is bounded at 256 KiB. Add scale-aware, wire and retry regressions.
Keep the existing reservoir budgets, pass floors and per-thread assertions. Publish unique-thread coverage and wait for it within the existing 20-second timeout instead of assuming a fixed number of random draws covers the pool. On timeout, report observed passes, coverage and every missing tid before the fatal assertion, including rejected tids. Add deterministic completion and fatal-diagnostic regressions without changing the production sampler.
Preserve retained context and epoch tails when skipping clean owned-run clears. Reconcile shared lazy backing and retain root accounting and generation-checked exits. Import allocation and Java-8 spin-hint regressions.
Keep TaskBlock admission and sampled-generation handshakes on the retained wall-clock transaction path. Preserve unowned trace provenance and epoch weights across context changes in filtered and unfiltered stackful sampling. Retain bootstrap test isolation, bounded sidecar allocation, tooling guards, and the published TaskBlock review corrections. Keep generations monotonic on ordinary slot reuse so stale owner tokens cannot clear a replacement run.
Skip only pushes without a same-repository open PR head at the pushed SHA. Exercise the workflow shell with hermetic event, head, pagination and error regressions.
60fac3c to
e5c07be
Compare
What does this PR do?:
Keeps the stack, tracing context and per-epoch weight attached to retained unowned wall-clock tails until a write succeeds, so tails survive call-trace rotation and JFR dumps with their original provenance. Also folds in the follow-ups to #663's review: owner-TLS context-window membership, lock-free thread retirement, timer-join retry, and DEBUG-only test seams.
Motivation:
In filtered precheck mode an unowned blocked thread records about one sample in ten and keeps the rest as pending weight against a cached trace. Before this change the cached trace could be rotated away, the tail was written with the current context instead of the original one, and it was scaled by the epoch in force at flush time rather than at observation time.
Additional Notes:
Human review: mandatory. The change touches signal-reachable sampling, lock ordering (epoch mutex → recording stripes →
_rec_lock) and JFR epoch metadata.Accepted costs (reviewer acknowledgment required):
Recording::_wall_epochsuntil a dump or a rare prune (floor 4096 entries, about 400 KiB, charged towallclock). The prune visits each stripe once as a barrier, never holding all of them.wall_block_tracker.stop().start()retries the join and is refused while it keeps failing.DDPROF_WALL_TIMER_DIAGNOSTICS(PROF-16795), the.picheckout-root fix (PROF-16721), and build/agent tooling changes (PROF-16796, PROF-16797).-O0workaround:WallClockBlockTracker::unownedContextCell()masks the slot asu32. Clang 14 at-O0on aarch64 lowers the signed masked subscript to a sign-extending byte load, so chunk offsets 128–255 indexed cells −128..−1 (caught by UBSan).UpperHalfChunkOffsetsUseTheirOwnCellfails without it. The comment states when to drop it (clang 15+ floor).mainthrough feat(wall): support unfiltered suppression and protect crash bootstrap (PROF-12146) #663: call-trace storage is now recording-scoped, so pending tails are dropped when storage is released at stop.How to test the change?:
./.claude/commands/build-and-summarize :ddprof-lib:gtestDebug(block tracker, wall epochs, thread filter, call-trace storage)../.claude/commands/build-and-summarize :ddprof-test:testDebug -Ptests='com.datadoghq.profiler.wallclock.*'and-Ptests='*Lifecycle*'.For Datadog employees:
credentials of any kind, I've requested a security review (run the
dd:platform-security-reviewskill, or file a request via the PSEC review form).
bewairealso runs automatically on every PR.Unsure? Have a question? Request a review!